{extend name='extra@admin/content'}

{block name="content"}
<table class="table table-hover">
    <thead>
        <tr>
            <th style="width:20px"></th>
            <th class='text-left'>系统节点结构</th>
            <th class='text-left'></th>
            <th>&nbsp;</th>
        </tr>
    </thead>
    <tbody>
        {foreach $nodes as $key=>$vo}
        <tr>
            <td style="width:20px"></td>
            <td class='text-left nowrap'>
                {$vo.spl}{$vo.node}
                {if auth("$classuri/save")}
                &nbsp;<input class='layui-input layui-input-inline title-input' style='height:28px;line-height:28px;width:auto' name='title.{$vo.node}' value="{$vo.title}"/>
                {/if}
            </td>
            <td class='text-left nowrap'>
                {if auth("$classuri/save")}
                <label>
                    {if substr_count($vo['node'],'/')==2}
                    {notempty name='vo.is_auth'}
                    <input name='is_auth.{$vo.node}' checked='checked' class="check-box" type='checkbox' value='1'/>
                    {else}
                    <input name='is_auth.{$vo.node}' class="check-box" type='checkbox' value='1'/>
                    {/notempty}
                    加入权限控制
                    {/if}
                </label>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <label>
                    {if substr_count($vo['node'],'/')==2}
                    {notempty name='vo.is_menu'}
                    <input name='is_menu.{$vo.node}' checked='checked' class='check-box' type='checkbox' value='1'/>
                    {else}
                    <input name='is_menu.{$vo.node}' class='check-box' type='checkbox' value='1'/>
                    {/notempty}
                    可设为菜单
                    {/if}
                </label>
                {/if}
            </td>
            <td style="width:100%"></td>
        </tr>
        {/foreach}
    </tbody>
</table>
{if auth("$classuri/save")}
<script>
    $(function () {
        $('input.title-input').on('blur', function () {
            $.form.load('{:url("save")}', {name: this.name, value: this.value}, 'POST', function (ret) {
                return false;
            });
        });
        $('input.check-box').on('click', function () {
            $.form.load('{:url("save")}', {name: this.name, value: this.checked ? 1 : 0}, 'POST', function (ret) {
                return false;
            });
        });
    });
</script>
{/if}
{/block}